Fix issue #654 Respect --model parameter when using custom base URL #694
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TLDR
Fixed the
--modelparameter being ignored when using a custom base URL. The CLI now correctly respects the model specified via-mor--modelflags when using alternative API endpoints.Dive Deeper
The issue was in the
createContentGeneratorConfigfunction inpackages/core/src/core/contentGenerator.ts. When using OpenAI auth type (triggered when a custom base URL is set), the code was overriding the model selection with theOPENAI_MODELenvironment variable or falling back toDEFAULT_QWEN_MODEL, completely bypassing the model specified through the CLI's--modelparameter.The fix ensures proper priority ordering:
--modelparameter) - highest priorityOPENAI_MODELorQWEN_MODEL) - fallbackThis same logic was applied to both OpenAI and QWEN OAuth authentication paths to ensure consistency.
Reviewer Test Plan
To validate this fix:
Test with custom base URL and model parameter:
Test that environment variable still works as fallback:
Test precedence (CLI flag should override env var):
Testing Matrix
Linked issues / bugs
Fixes #654